package com.company.singleton;

/**
 * 饿汉式单例
 * @author HuangZiy
 * @date 2020/09/12
 */
public class Hungary {
    /**
     * 构造器必须私有
     */
    private Hungary(){}
    /**
     * 每次都会加载，有可能会浪费空间
     */
    private final static Hungary HUNGARY = new Hungary();

    private static Hungary getInstance(){
        return HUNGARY;
    }
}
